package combat5;

import org.omg.CosNaming.*;

import DomainObject.BanqueReactionsImpl;
//create by martin souliere
public class Module {
	public static org.omg.PortableServer.POA _poa;
	public static void main(String[] args) {
		// Initialize ORB
		org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
		
		try {
			org.omg.PortableServer.Servant servantBanqueReactions;
			org.omg.CORBA.Object oBanqueReactions;

			// Initialize POA
			_poa = org.omg.PortableServer.POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
			_poa.the_POAManager().activate();

			// Initialize servant (Remote Object), convert to CORBA reference
			servantBanqueReactions = new BanqueReactionsImpl();
			oBanqueReactions = _poa.servant_to_reference(servantBanqueReactions);

			// Register Rermote Object with naming context
			NamingContextExt nc = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService"));
			NameComponent[] nameBanqueReactions = new NameComponent[] { new NameComponent("BanqueReactions", "module1") };
			nc.rebind(nameBanqueReactions, oBanqueReactions);
		} catch (Exception e) {
			e.printStackTrace();
		}
		// Start the ORB main thread
		orb.run();
	}
}
